<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<body class="hold-transition skin-blue sidebar-mini">
<section class="content">
    <button class="btn btn-info pull-right" shiro:hasPermission="data:proCard:print" onclick="Print('#print')">打印</button>
    <div class="row" style="margin-top: 64px">
        <div class="col-xs-10 col-xs-offset-1">
            <div id="print">
                <table class="t1">
                    <thead style="display: table-header-group">
                    <tr>
                        <td colspan="10">
                            <img th:src="@{/img/logo3.jpg}" width="64px" height="40px" style="margin-top: -20px">
                            <div style="display: inline-block;margin-top: 5px;margin-left: 20px">
                                <span style="letter-spacing: 24px;display: block;line-height: 20px">&nbsp;辽宁忠旺机械设备制造有限公司</span>
                                <span style="display: block;font-size: 12px;line-height: 20px">Liaoning Zhongwang Machinery Equipment Manufacturing Co., Ltd</span>
                            </div>
                        </td>
                        <td colspan="2">工艺过程卡</td>
                        <td rowspan="4" colspan="2">
                            <div id="qrCode-div" style="display: none"></div>
                            <img id="qr-img" width="100px" height="100px">
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 8%">项目编号</td>
                        <td colspan="2" style="width: 12%;font-size: 14px;">
                            [[${card.prodNo}]]
                        </td>
                        <td style="width: 8%">项目名称</td>
                        <td colspan="2" style="width: 16%">
                            [[${card.proName}]]
                        </td>
                        <td style="width: 8%">项目数量</td>
                        <td style="width: 6%">
                            [[${card.proNum}]]
                        </td>
                        <td style="width: 8%">类型</td>
                        <td style="width: 7%">
                            [[${card.special}]]
                        </td>
                        <td style="width: 8%">部分</td>
                        <td style="width: 7%">
                            [[${card.part}]]
                        </td>
                    </tr>
                    <tr>
                        <td rowspan="2">零件图号</td>
                        <td rowspan="2" colspan="3">
                            [[${card.drawNo}]]
                        </td>
                        <td rowspan="2" style="width: 8%">零件名称</td>
                        <td rowspan="2">
                            [[${card.drawName}]]
                        </td>
                        <td>零件数量</td>
                        <td>
                            [[${card.drawNum}]]
                        </td>
                        <td>材质</td>
                        <td>
                            [[${card.quality}]]
                        </td>
                        <td>重量(kg)</td>
                        <td>
                            [[${T(com.zw.mes.util.BigDecimalUtils).valueFormat(card.weight)}]]
                        </td>
                    </tr>
                    <tr>
                        <td>规格</td>
                        <td colspan="5">
                            [[${card.spec}]]
                        </td>
                    </tr>
                    <tr>
                        <td rowspan="2">路线</td>
                        <td rowspan="2" style="width: 5%">序号</td>
                        <td rowspan="2" style="width: 7%">工序</td>
                        <td rowspan="2">设备名称</td>
                        <td rowspan="2" colspan="5">工艺内容</td>
                        <td colspan="2">工时定额</td>
                        <td rowspan="2">操作者</td>
                        <td colspan="2">检查结果</td>
                    </tr>
                    <tr>
                        <td>准备</td>
                        <td>单件</td>
                        <td style="width: 6%">交检数量</td>
                        <td style="width: 6%">检查员</td>
                    </tr>
                    </thead>
                    <tbody id="card">
                    <tr th:each="d : ${details}">
                        <td th:text="${d.route}"></td>
                        <td th:text="${d.orderNo}"></td>
                        <td th:text="${d.process}"></td>
                        <td th:text="${d.equName}"></td>
                        <td style="text-align: left" colspan="5" th:utext="${d.craftContent}"></td>
                        <td th:text="${#numbers.formatDecimal(d.workTimeOne,1,2)}"></td>
                        <td th:text="${#numbers.formatDecimal(d.workTimeTwo,1,2)}"></td>
                        <td></td>
                        <td></td>
                        <td></td>
                    </tr>
                    </tbody>
                    <tfoot>
                    <tr>
                        <td>编制人员</td>
                        <td colspan="2" th:text="${card.createName}"></td>
                        <td>联系电话</td>
                        <td colspan="2" th:text="${card.createTel}"></td>
                        <td>审核人员</td>
                        <td colspan="2" th:text="${card.checkName}"></td>
                        <td>审核时间</td>
                        <td colspan="2" th:text="${#dates.format(card.checkTime,'yyyy.MM.dd')}"></td>
                        <td colspan="2"></td>
                    </tr>
                    <tr>
                        <td>定额人员</td>
                        <td colspan="2" th:text="${card.quotaName}"></td>
                        <td>下达日期</td>
                        <td colspan="2" th:text="${#dates.format(card.notifyTime,'yyyy.MM.dd')}"></td>
                        <td>修改人员</td>
                        <td colspan="2" th:text="${card.updateName}"></td>
                        <td>修改日期</td>
                        <td colspan="2" th:text="${#dates.format(card.updateTime,'yyyy.MM.dd')}"></td>
                        <td colspan="2"></td>
                    </tr>
                    </tfoot>
                </table>
            </div>

        </div>
    </div>
</section>
<div th:include="include :: footer"></div>
<script th:inline="javascript">

    let gloDeptName = toUtf8([[${card.prodNo}]] + "|" + [[${card.drawNo}]] +"|" + [[${card.partId}]] + "|" + "1");
    // let gloDeptName = toUtf8([[${card.id}]] + "|" + "1");

    $("#qrCode-div").qrcode({
        width: 100,
        height: 100,
        text: gloDeptName
    });

    $(function () {
        let c = document.getElementsByTagName('canvas')[0];
        $("#qr-img").attr("src", c.toDataURL("image/png"));
    });
</script>
</body>
</html>
